package com.lzl.utils.fastjson2;

import com.alibaba.fastjson2.JSONWriter;
import com.alibaba.fastjson2.filter.PropertyPreFilter;

import java.util.Set;

public class FastJson2SensitivePropFilter implements PropertyPreFilter {

    public FastJson2SensitivePropFilter(Set<String> excludes){
        this.excludes = excludes;
    }

    private Set<String> excludes;
    @Override
    public boolean process(JSONWriter jsonWriter, Object obj, String propertyName) {
        if(excludes == null){
            return true;
        }
        boolean isNeed = !excludes.contains(propertyName);
        return isNeed;
    }
}
